﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace Web_Guia_Digital_Georeferenciada.Mapas
{
    /// <summary>
    /// Descripción breve de LocationService
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // Para permitir que se llame a este servicio web desde un script, usando ASP.NET AJAX, quite la marca de comentario de la línea siguiente. 
    [System.Web.Script.Services.ScriptService]
    public class LocationService : System.Web.Services.WebService
    {
        [WebMethod]
        public Location[] FindLocations(String zipCode)
        {
            List<Location> locations = new List<Location>();

            if (zipCode == "92805")
            {
                Location loc = new Location();
                loc.Name = "Store #1";
                loc.StreetAddress = "275 S Harbor Blvd";
                loc.City = "Anaheim";
                loc.State = "CA";
                loc.Zip = "92805";
                loc.Phone = "(714) 555-5555";
                loc.Distance = "0.2 miles";
                locations.Add(loc);

                loc = new Location();
                loc.Name = "Store #2";
                loc.StreetAddress = "1189 S State College Blvd";
                loc.City = "Anaheim";
                loc.State = "CA";
                loc.Zip = "92806";
                loc.Phone = "(714) 555-1234";
                loc.Distance = "1.6 miles";
                locations.Add(loc);
            }

            return locations.ToArray();
        }

          }
}
